package com.cnzha.mr.friend;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

/**
 * @Description:
 * @Author: xiizhao
 * @Date: 14:16 2020/4/7
 */
public class NewTwoFriendReduce extends Reducer<Text, Text, Text, Text> {

    @Override
    protected void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException {

        StringBuffer temp = new StringBuffer();
        for (Text value : values) {
            String valStr = value.toString();
            temp = temp.append(valStr).append("\t");
        }
        context.write(key, new Text(temp.toString()));
    }
}
